import request from '@/js/ajax'

export function allCourseList(tenantId) {
    return request({
        url: 'http://www.rhyun.top:/8080/course/allList',
        method: 'get',
        params: {tenantId}

    })
}

export function parentCourseList(parentId, tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/course/findCourseList',
        method: 'get',
        params: {parentId, tenantId}

    })
}

//资讯
export function infoList(tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/index/infoList',
        method: 'get',
        params: {tenantId}

    })
}

export function infoDetail(id) {
    return request({
        url: 'http://www.rhyun.top:8080/index/infoDetail',
        method: 'get',
        params: {id}

    })
}


//父分类
export function parentCategoryList(tenantId, type) {
    return request({
        url: 'http://www.rhyun.top:8080/category/parentCategoryList',
        method: 'get',
        params: {tenantId, type}

    })
}

//课程详情
export function courseDetail(id, userId) {
    return request({
        url: 'http://www.rhyun.top:8080/course/detail',
        method: 'get',
        params: {id, userId}
    })
}

export function creatCollect(userId, courseId, tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/course/collect',
        method: 'get',
        params: {userId, courseId, tenantId}
    })
}


//评价课程
export function creatComment(userId, content, rating, tenantId, courseId) {
    return request({
        url: 'http://www.rhyun.top:8080/course/creatComment',
        method: 'get',
        params: {userId, content, rating, tenantId, courseId}
    })
}


//获取视频url,凭证
export function getVideoInfo(videoId) {
    return request({
        url: 'http://www.rhyun.top:8080/course/getVideoInfo',
        method: 'get',
        params: {videoId}
    })
}

//搜索课程
export function searchCourse(tenantId, keyWord) {
    return request({
        url: 'http://www.rhyun.top:8080/course/searchCourse',
        method: 'get',
        params: {tenantId, keyWord}

    })
}


//轮播图
export function rotationChart(tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/index/getRotationChart',
        method: 'get',
        params: {tenantId}

    })
}

//轮播图
export function rotationCharts(tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/index/getRotationCharts',
        method: 'get',
        params: {tenantId}

    })
}


export function getSign(tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/wxpay/getSign',
        method: 'get',
        params: {tenantId}

    })
}

//JSAPI接口签名
export function getJsapiSign(tenantId, accessToken, ticket, linkUrl) {
    return request({
        url: 'http://www.rhyun.top:8080/wxpay/getJsapiSign',
        method: 'get',
        params: {tenantId, accessToken, ticket, linkUrl}
    })
}


//创建课程支付记录
export function createPayRecord(goodsId, tenantId, userId, code, price) {
    return request({
        url: 'http://www.rhyun.top:8080/wxpay/createPayRecord',
        method: 'get',
        params: {goodsId, tenantId, userId, code, price}

    })

}

//创建购买会员支付记录
export function createVipPayRecord(goodsId, tenantId, userId, code, type) {
    return request({
        url: 'http://www.rhyun.top:8080/wxpay/createVipPayRecord',
        method: 'get',
        params: {goodsId, tenantId, userId, code, type}
    })

}

//开通会员
export function openVip(levelId, tenantId, userId) {
    return request({
        url: 'http://www.rhyun.top:8080/wxpay/openVip',
        method: 'get',
        params: {levelId, tenantId, userId}
    })

}


//用户信息
export function userInfo(userId) {
    return request({
        url: 'http://www.rhyun.top:8080/user/userInfo',
        method: 'get',
        params: {userId}

    })

}

//会员服务列表
export function userLevels(tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/user/userLevels',
        method: 'get',
        params: {tenantId}

    })

}

export function updateUserInfo(name, signature, largeAvatar, userId) {
    return request({
        url: 'http://www.rhyun.top:8080/user/updateUserInfo',
        method: 'get',
        params: {name, signature, largeAvatar, userId}

    })

}


//搜索课程
export function recommendCourse(tenantId) {
    return request({
        url: 'http://www.rhyun.top:8080/find/recommendCourse',
        method: 'get',
        params: {tenantId}
    })
}

